import request from '@/config/axios'

// 设备分组 VO
export interface DeviceGroupVO {
  id: number // 分组ID
  name: string // 分组名称
  remark: string // 备注
}

// 设备分组 API
export const DeviceGroupApi = {
  // 查询设备分组分页
  getDeviceGroupPage: async (params: any) => {
    return await request.get({ url: `/vmiot/device-group/page`, params })
  },

  // 查询所有设备分组列表
  getAllDeviceGroupList: async () => {
    return await request.get({ url: `/vmiot/device-group/all-list` })
  },

  // 查询设备分组详情
  getDeviceGroup: async (id: number) => {
    return await request.get({ url: `/vmiot/device-group/get?id=` + id })
  },

  // 新增设备分组
  createDeviceGroup: async (data: DeviceGroupVO) => {
    return await request.post({ url: `/vmiot/device-group/create`, data })
  },

  // 修改设备分组
  updateDeviceGroup: async (data: DeviceGroupVO) => {
    return await request.put({ url: `/vmiot/device-group/update`, data })
  },

  // 删除设备分组
  deleteDeviceGroup: async (id: number) => {
    return await request.delete({ url: `/vmiot/device-group/delete?id=` + id })
  },

  // 导出设备分组 Excel
  exportDeviceGroup: async (params) => {
    return await request.download({ url: `/vmiot/device-group/export-excel`, params })
  }
}
